//
//  MessageViewController.m
//  e律师
//
//  Created by 韦淋 on 2017/5/15.
//  Copyright © 2017年 test. All rights reserved.
//

#import "MessageViewController.h"
#import "MessageCell.h"
#import "CaseDetailViewController.h"

#define SCREEN_SIZE [UIScreen mainScreen].bounds.size
#define LEFTSIDE_WIDTH (SCREEN_SIZE.width * 0.5)

@interface MessageViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView *messageTableView;
@property (nonatomic, strong) NSArray *messageDataSource;
@end

@implementation MessageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self InitializeInterface];
    self.view.backgroundColor = [UIColor whiteColor];
    
}
- (void)InitializeInterface{
    [self.view addSubview:self.messageTableView];
}

#pragma mark - UITableViewDelegate,UITableViewDataSource

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 100;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 10;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:@"messageCell" forIndexPath:indexPath];
//    [cell.image sd_setImageWithURL:self.allInfoList[indexPath.row][@"sThumb"]];
    cell.titleLable.text = @"主任收案批审通过";
    cell.contentLable.text = @"您办理的《2017（民）第006号》主任收案批审通过！将移交财务审批";
    cell.dateLable.text = @"2017/4/13";
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.backgroundColor = [UIColor blueColor];
    cell.layer.cornerRadius = 5;
    cell.layer.masksToBounds = YES;
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    NSLog(@"1");
    CaseDetailViewController *caseDetailVC = [[CaseDetailViewController alloc] init];
    [self.navigationController pushViewController:caseDetailVC animated:YES];
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    UIView *space = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 5)];
    space.backgroundColor = [UIColor clearColor];
    return space;
}

#pragma mark - Getter/Setter
- (UITableView *)messageTableView{
    if (!_messageTableView) {
        _messageTableView = [[UITableView alloc] initWithFrame:CGRectMake(10, 0, SCREEN_SIZE.width - 20, SCREEN_SIZE.height) style:UITableViewStylePlain];
        _messageTableView.backgroundColor = [UIColor clearColor];
        _messageTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _messageTableView.delegate = self;
        _messageTableView.dataSource = self;
        _messageTableView.estimatedRowHeight = 180;
        [_messageTableView registerClass:[MessageCell class] forCellReuseIdentifier:@"messageCell"];
    }
    return _messageTableView;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
